class PrivsController < ApplicationController
  # GET /privs
  # GET /privs.xml
  def index
    @privs = Priv.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @privs }
    end
  end

  # GET /privs/1
  # GET /privs/1.xml
  def show
    @priv = Priv.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @priv }
    end
  end

  # GET /privs/new
  # GET /privs/new.xml
  def new
    @priv = Priv.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @priv }
    end
  end

  # GET /privs/1/edit
  def edit
    @priv = Priv.find(params[:id])
  end

  # POST /privs
  # POST /privs.xml
  def create
    @priv = Priv.new(params[:priv])

    respond_to do |format|
      if @priv.save
        flash[:notice] = 'Priv was successfully created.'
        format.html { redirect_to(@priv) }
        format.xml  { render :xml => @priv, :status => :created, :location => @priv }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @priv.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /privs/1
  # PUT /privs/1.xml
  def update
    @priv = Priv.find(params[:id])

    respond_to do |format|
      if @priv.update_attributes(params[:priv])
        flash[:notice] = 'Priv was successfully updated.'
        format.html { redirect_to(@priv) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @priv.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /privs/1
  # DELETE /privs/1.xml
  def destroy
    @priv = Priv.find(params[:id])
    @priv.destroy

    respond_to do |format|
      format.html { redirect_to(privs_url) }
      format.xml  { head :ok }
    end
  end
end
